package com.bbjob.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.bbjob.entity.JwtUser;
import com.bbjob.sec.SecContextUtil;
import com.bbjob.sec.vo.UserVo;
import com.bbjob.service.impl.UserServiceImpl;


@RestController
@RequestMapping("sec")
public class SecurityController {
	
	@Resource
	private UserServiceImpl userService;
	
	@GetMapping("user")
	public UserVo getUser() {
		JwtUser user = SecContextUtil.getCurrentUser();
		
		// JwtUser user = (JwtUser)userService.loadUserByUsername(username);
		
		UserVo vo=new UserVo(user.getId(),user.getUsername(), user.getRealname(), user.getType());	
		return vo;
	}
}
